package xuanke;
	public class Student {
	    private String id;          // 学生编号
	    private String name;        // 学生姓名
	    private String gender;      // 学生性别
	    private Course course;      // 所选课程
	    
	    // 构造方法
	    public Student(String id, String name, String gender) {
	        this.id = id;
	        this.name = name;
	        this.gender = gender;
	    }
	    
	    public String getId() { return id; }
	    public void setId(String id) { this.id = id; }
	    
	    public String getName() { return name; }
	    public void setName(String name) { this.name = name; }
	    
	    public String getGender() { return gender; }
	    public void setGender(String gender) { this.gender = gender; }
	    
	    public Course getCourse() { return course; }
	    public void setCourse(Course course) { this.course = course; }
	    
	    // 选课方法
	    public void selectCourse(Course course) {
	        this.course = course;
	        System.out.println(name + "同学已选择" + course.getCourseName() + "课程");
	    }
	    
	    // 退课方法
	    public void dropCourse() {
	        if (course != null) {
	            System.out.println(name + "同学已退选" + course.getCourseName() + "课程");
	            course = null;
	        } else {
	            System.out.println(name + "同学当前没有选课");
	        }
	    }
	    
	    // 查询选课信息
	    public void queryCourseInfo() {
	        if (course != null) {
	            System.out.println("学生编号：" + id);
	            System.out.println("学生姓名：" + name);
	            System.out.println("所选课程：" + course.getCourseName());
	            System.out.println("上课地点：" + course.getLocation());
	            System.out.println("上课时间：" + course.getTime());
	            System.out.println("授课教师：" + course.getTeacher().getName());
	        } else {
	            System.out.println(name + "同学当前没有选课");
	        }
	    }
	}
	
